<script>
$(document).ready(function(){
	{params}
	
	var c = {
		cnum:'',
		ismanage:0,
		inits:function(){
			if(params.cnum)this.cnum = params.cnum;
			this.info = params;
			$('#name{rand}').html(this.info.name);
			this.getinfo();
		},
		getinfo:function(){
			js.ajax.get({
				url:xcy.getacturl('imgroup','chatinfo'),
				cnum:this.cnum,
				urlda:{
					id:this.info.id,
					type:this.info.type
				}
			},function(ret){
				c.showinfo(ret.data);
			});
		},
		showinfo:function(da){
			var info = da.info;
			this.ismanage = da.ismanage;
			this.groupinfo= info;
			$('#name{rand}').html(info.name);
			$('#explain{rand}').html(info.explain);
			$('#bqname{rand}').html(info.bqname);
			$('#bqcolor{rand}').html(info.bqcolor);
			$('#ushu{rand}').html(info.ushu+'人');
			get('face_{rand}').src = getface(info.face);
			this.showlist(da.userarr);
		},
		showlist:function(da){
			var s = '<table width="100%"><tr>',d,hei=30,oi=0;
			this.userarr = da;
			if(da)for(var i=0;i<da.length;i++){
				oi++;
				d = da[i];
				s+='<td clickevt="userclick,'+i+'" align="center" width="20%" style="padding:10px;cursor:pointer">';
				s+='	<div style="height:'+hei+'px;overflow:hidden"><img class="radius5" height="'+hei+'px" src="'+getface(d.face)+'"></div>';
				s+='	<div class="fontsize12 hui">'+d.name+'</div>';
				s+='</td>';
				if(oi%5==0)s+='</tr></tr>';
			}
			if(da.length<5)s+='<td></td>';
			s+='</tr></table>';
			$('#list{rand}').html(s);
			js.initbtn(this);
		},
		closes:function(){
			reim.closetabsnow();
		},
		userclick:function(o,i,v1,evt){
			var da = [{name:'@AT',lx:0}],d = this.userarr[i];
			if(this.ismanage==1)da.push({name:'移除群会话',lx:1});
			importjs('menu','create', {
				obj:$(o),data:da,width:120,
				onclick:function(d1){
					c.userclicks(d1.lx, d, o);
				},
				showXY:{
					left:evt.clientX+3,
					top:evt.clientY+3
				}
			});
		},
		userclicks:function(lx, d, o){
			var bh = this.info.bh;
			if(lx==0){
				if(reim[bh]){
					reim.showtabs(bh);
					reim[bh].sendatid(d.id,d.name);
				}
			}
			if(lx==1){
				js.ajax.get({
					url:'api/reim/groupexit',
					cnum:this.cnum,
					loading:'移除中..',
					loadsuccess:'已移除',
					urlda:{
						type:this.info.type,
						gid:this.info.id,
						sid:d.id
					}
				},function(ret){
					$(o).remove();
					if(reim[bh])reim[bh].showreceinfo(false);
					$('#ushu{rand}').html((parseFloat(c.groupinfo.ushu)-1)+'人');
				});
			}
		},
		editinfo:function(o,fid){
			if(this.ismanage==0)return;
			var btarr = {};
			btarr.name='群名称';
			btarr.bqname='标签';
			btarr.bqcolor='标签颜色';
			btarr.explain='说明公告';
			var val = this.groupinfo[fid];
			var can = {
				title:btarr[fid],
				msg:'请输入',
				value:val,
				type:'text'
			}
			if(fid=='explain')can.type='';
			js.modal.prompt(can, function(jg,txt){
				if(jg=='yes' && txt != val)c.savegroupinfo(fid,txt);
			});
		},
		savegroupinfo:function(fid,val){
			js.ajax.get({
				url:'api/reim/groupedit',
				loading:'修改中',
				loadsuccess:'修改成功',
				data:{
					id:this.info.id,
					fields:fid,
					value:jm.base64encode(val)
				}
			},function(){
				$('#'+fid+'{rand}').html(val);
			});
		}
	}
	c.inits();
	
});
</script>
<div align="center" style="padding:15px 0px">
	<div align="center" style="padding:10px 0px"><img style="width:60px;height:60px;border-radius:50%" onclick="js.viewimg(this)" id="face_{rand}" src="images/noimg.jpg" align="absmiddle"></div>
	
	
	<div style="max-width:300px;" align="left">
		<div style="padding:10px 5px 2px 10px;" class="hui fontsize12">会话群信息</div>
		<div class="rock-panel rock-border rock-radius rock-list-group">
			<div class="rock-list-item rock-hover" clickevt="editinfo,name">
				群名称
				<font class="hui"><span style="font-size:14px" id="name{rand}"></span>&nbsp;<i class="icon-angle-right"></i></font>
			</div>
			<div class="rock-list-item">
				人员数
				<font class="hui"><span style="font-size:14px" id="ushu{rand}">0人</span></font>
			</div>
			<div class="rock-list-item rock-hover" clickevt="editinfo,bqname">
				标签
				<font class="hui"><span style="font-size:14px" id="bqname{rand}"></span>&nbsp;<i class="icon-angle-right"></i></font>
			</div>
			<div class="rock-list-item rock-hover" clickevt="editinfo,bqcolor">
				标签颜色
				<font class="hui"><span style="font-size:14px" id="bqcolor{rand}"></span>&nbsp;<i class="icon-angle-right"></i></font>
			</div>
			<div class="rock-list-item rock-hover" clickevt="editinfo,explain">
				说明公告
				<font class="hui"><span style="font-size:14px" id="explain{rand}"></span>&nbsp;<i class="icon-angle-right"></i></font>
			</div>

		</div>
	
	</div>
	
	<div style="max-width:300px;" align="left">
		<div style="padding:15px 5px 2px 10px;" class="hui fontsize12">会话群下人员</div>
		<div id="list{rand}" class="rock-panel rock-border rock-radius rock-list-group">
			
		</div>
	</div>


	<div style="margin-top:30px"><input clickevt="closes" style="width:150px" type="button" value="关闭" class="webbtn bg-outline-danger rock-border rock-hover"></div>	
	
</div>